//
//  PAResultViewController.m
//  PAMobileWallet
//
//  Created by Pay_SMP002 on 13-7-3.
//  Copyright (c) 2013年 平安付. All rights reserved.
//

#import "PAResultViewController.h"
#import "PARegisterResultView.h"
#import "PublicDefine.h"

#import "PAPersonalViewController.h"
#import "PALoginViewController.h"
#import "PAAddCardViewController.h"

@interface PAResultViewController ()

@end

@implementation PAResultViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self)
    {
        registerView = [[PARegisterResultView alloc] initWithFrame:RECT_PHONE];
        registerView.parentController = self;
        registerView.backgroundColor = BGVIEW_COLOR;
        self.view = registerView;
        
        navView = [[PANavView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 44)];
        navView.delegate = self;
        [navView setTitle:@"注册结果"];
        [registerView addSubview:navView];
    }
    return self;
}

#pragma mark - PANavViewDelegate methods

- (void)sendSelf:(PANavView *)sendView
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)setResultType:(RESULT_TYPE)type
{
    switch (type)
    {
        case RESULT_TYPE_register:
            self.view = registerView;
            break;

        default:
            break;
    }
}

- (void)setTitleName:(NSString *)name
{
    self.title = name;
}

- (void)testNext:(id)sender
{
    int tag = [(UIButton *)sender tag];
    PABaseViewController * controller = nil;

    if (tag == 0)   // 去绑卡
    {
        if (!addCardViewController)
        {
            addCardViewController = [[PAAddCardViewController alloc] initWithNibName:nil bundle:nil];
            addCardViewController.parentController = self;
        }
        controller = addCardViewController;
        [self.navigationController pushViewController:controller animated:NO];
    }
    else if (tag == 1)  // 去首页
    {
        PAPersonalViewController *personVC = [self findPersonCenterViewConteroller];
        [personVC checkUpOrDown:@"down"];
        [self.navigationController popToViewController:personVC animated:YES];
    }
}

- (void)viewDidLoad
{
    [super viewDidLoad];
}

- (void)viewDidAppear:(BOOL)animated
{
    //
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
}

@end
